package xyz.csmcool.imroom.feignclient;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import xyz.csmcool.imroom.config.FeignMultipartSupportConfig;
import xyz.csmcool.imutil.dto.LastMessageDto;
import xyz.csmcool.imutil.dto.LastPrivateMessageDto;
import xyz.csmcool.imutil.webVo.ResultVo;

import java.util.List;

/**
 * @author 什锦
 * @Package xyz.csmcool.imroom.feignclient
 * @since 2022/8/18 2:04
 */
@FeignClient(name="imchat",fallback = ChatDegradeFeignClient.class)
@Component
public interface ChatClient {

    /**
     * 获取每个房间的最后一条信息*
     * @param ids
     * @return
     */
    @GetMapping("/roomsChats/getLastMessage")
    public ResultVo<List<LastMessageDto>> getLastMessage(@RequestParam("roomIds") List<Integer> ids);

    /**
     * 获取每个用户的最后一条信息*
     * @param ids
     * @param uid *
     * @return
     */
    @GetMapping("/privateChats/getLastPrivateMessage")
    public ResultVo<List<LastPrivateMessageDto>> getLastPrivateMessage(@RequestParam("fids") List<Integer> ids,
                                                                       @RequestParam("uid") Integer uid);

    /**
     * 删除聊天记录
     * @param roomId
     * @return
     */
    @PostMapping("/roomsChats/delete-room-chats")
    public ResultVo deleteRoomChats(@RequestParam("id") Integer roomId);
}
